package com.baiyue.mapper;

import com.baiyue.entity.TollRules;
import com.baiyue.model.SelectOptionsResult;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 *
 * @author 伍波
 * @date 2024-04-30
 */
@Mapper
public interface TollRulesMapper extends BaseMapper<TollRules> {
    @Select({
            "select",
            "*",
            "from toll_rules",
            "where billing_name = #{billingName}  and status != 1"
    })
    TollRules findByBillingName(String billingName);

    /**
     * 根据id批量删除-假删除
     * @param paramMap
     * @return
     */
    Integer deleteTollRulesByIds(Map<String,Object> paramMap);


    /**
     * 分页查询 计费规则信息
     * @param tollRules
     * @return
     */
    List<TollRules> findByPage(TollRules tollRules, Pagination page);

    @Select({
            "select",
            "*",
            "from toll_rules",
            "where id = #{id} and `status` != 1"
    })
    TollRules selectById(Integer id);

    /**
     * 查询id和名称
     * @return
     */
    List<SelectOptionsResult> findIdAndBillingName();
}
